{include file="public/public"}
<div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
    <div class="layui-body layui-tab-content site-demo site-demo-body">
        <div class="layui-tab-item layui-show">
            <div class="layui-main">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                </fieldset>
                <span class="layui-breadcrumb">
                    <a href="__APP__/{$menuConfigArry['functionMod']}/{$menuConfigArry['menuLabel']}">{$menuConfigArry['pmenuName']}</a>
                    <a><cite>{$menuConfigArry['menuName']}</cite></a>
                </span>
                <hr>


                <div class="layui-form-item" style="margin-top: 20px;">
                    <div class="layui-inline">
                        <label class="layui-form-label">分类查找：</label>
                        <div class="layui-input-inline">
                            <input id='souname'  name="text2" type="text" class="layui-input" />
                        </div>
                        <a href="#" onClick="subsou()" class="layui-btn ">查询</a>

                    </div>
                    <div class="layui-inline">
                        <a href="__APP__/admin/operationlog?type=hotelGroup">操作日志</a>
                    </div>

                </div>

                  <table class="layui-table" lay-skin="line" >
                   <thead >
                    <tr>
                        <td width="75">选择</td>
                        <td width="85">编号</td>
                        <td width="267">酒店分类名</td>


                        <td width="180">操作</td>
                    </tr>
                    </thead>
                    <tbody>
                    <?
     if($roomArr){
      foreach($roomArr as $val){
        $tmp = addslashes(json_encode($val));
     ?>
                    <tr >
                        <td><input  type="checkbox" name="roombox" id="roombox"  value="{$val[id]}"></td>
                        <td>{$val[id]}</td>
                        <td>{$val[groupname]}</td>

                        <td>
                            <a href="#" class="layui-btn layui-btn-sm" onclick='edit("{$tmp}",2)'>修改 </a>
                        </td>
                    </tr>
                    <?php
		}
	}?>
                    </tbody>
                </table>
                <div class="content_1234">
                    <div class="content_glcz">管理操作：全选
                        <input type="checkbox"  onClick="checkallstu(this)" />
                        <input name="submit" type="submit" value="删除"  onclick="delall()" class="layui-btn layui-btn-sm layui-btn-warm"/>
                        <input name="submit2" type="button" value="添加分类" onclick="aadd()" class="layui-btn layui-btn-sm"/>
                    </div>
                    <div class="layui-box layui-laypage layui-laypage-default">{$page}</div>
                </div>

                <FORM action="__APP__/admin/addhotelGroup" enctype="multipart/form-data"method="post" >
                    <div id="show" style="DISPLAY:none" class="show">
                        <table class="layui-table" lay-skin="line">
                           <thead >
                            <tr>
                                <td colspan="2">酒店分类管理</td>
                                <input type="hidden" id="id" name="id">

                            </tr>
                            </thead>
                            <tbody>
                            <tr class="ctt_gr">
                                <td width="154" align="right">酒店集团：</td>
                                <td width="338" align="left">
                                    <input class="textField_hp1"  size="20" id="hotel2" name="groupname"/>
                                </td>
                            </tr>

                            <tr class="ctt_gr">
                                <td width="154" align="right">联系人：</td>
                                <td width="338" align="left">
                                    <input class="textField_hp1"  size="20" id="name" name="name"/>
                                </td>
                            </tr>
                            <tr class="ctt_gr">
                                <td align="right">手&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                                <td align="left"><input class="textField_hp1" size="15" id="phone" name="phone"/></td>
                            </tr><tr class="ctt_gr">
                                <td align="right">座&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                                <td align="left"><input class="textField_hp1" size="15" id="landline" name="landline" /></td>
                            </tr><tr class="ctt_gr">
                                <td align="right">邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
                                <td align="left"><input class="textField_hp1" size="15" id="email" name="email" /></td>
                            </tr><tr class="ctt_gr">
                                <td align="right">其&nbsp;&nbsp;&nbsp;&nbsp;他：</td>
                                <td align="left"><input class="textField_hp1" size="15" id="other" name="other"/></td>
                            </tr>
                            <tr class="ctt_gr">
                                <td height="31" colspan="2" align="center"><input name="submit22" type="submit" value="确定" border="0"  class="layui-btn" id="ok"/>
                                    <input name="submit22" type="button" value="取消" border="0" onclick="document.getElementById
	('show').style.display='none'" class="layui-btn layui-btn-warm"/></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                </FORM>



            </div>
        </div>
    </div>
</div>
<script language="javascript">
function checkallstu(o) {
	if(o.checked){
		$("input[name='roombox']").attr("checked",true);
	}else{
		$("input[name='roombox']").attr("checked",false);
	}
}
function aadd(){
	$("#show").show();
}

function delall(){
    var arr="";
    $("input[name=roombox]:checked").each(function(){
    	arr+=$(this).val()+",";
    })
    if(arr==""){
    	alert('请选择要删除的记录');
		return false; 
    }
    if (confirm("您确定要删除吗？")){
         $.post("__APP__/admin/delallhotelGroup",{
    	arr : arr
	    }, function(data) {
		if(data.msg=="1"){
			alert("删除成功");
			location.reload();
		}else{
			alert("删除失败");
	    	}
	    },"json");
    }else{
       return false;}
}
function edit(val,flag){
    var json=JSON.parse(val);

	$("#id").val(json.id);
	$("#hotel2").val(json.groupname);

    var movieInfo=json.content.split("@");

    var name =movieInfo[0];
    var phone =  movieInfo[1];
    var landline=movieInfo[2];
    var email=movieInfo[3];
    var other=movieInfo[4];
    $("#name").val(name);
    $("#phone").val(phone);
    $("#landline").val(landline);
    $("#email").val(email);
    $("#other").val(other);
    $("#show").show();
}


function subsou(){
	var souname = $("#souname").val();
	window.location.href='__APP__/admin/hotelGroup?groupname='+souname;
}
</script>


